package org.computate.form.item;

import java.util.ArrayList;
import java.util.List;


public class FormItem {
	
	private Class<?> c;
	private List<FormItem> hiddenItems = new ArrayList<FormItem>();
	private FormItem parent;
	private String label;
	
	public Class<?> getC() {
		return c;
	}

	
	public void setC(Class<?> c) {
		this.c = c;
	}


	public List<FormItem> getHiddenItems() {
		return hiddenItems;
	}


	public FormItem setHiddenItems(List<FormItem> hiddenItems) {
		this.hiddenItems = hiddenItems;
		
		for(FormItem hiddenItem : hiddenItems) {
			hiddenItem.setParent(this);
		}
		
		return this;
	}
	
	public FormItem addHiddenItem(FormItem hiddenItem) {
		this.hiddenItems.add(hiddenItem);
		
		hiddenItem.setParent(this);
		
		return this;
	}


	public FormItem getParent() {
		return parent;
	}


	public void setParent(FormItem parent) {
		this.parent = parent;
	}
	
	public String getLabel() {
		return label;
	}
	
	public FormItem setLabel(String label) {
		this.label = label;
		
		return this;
	}
}
